clear*
set maxvar 11000

global date _2025_10_28
cd "/Users/atri0032/Dropbox/World Bank/Temperature, poverty, and inequality/Estimations/"

*************************************************************************************************
********************************** Figure S1: Subnational poverty and inequality – SPID database
*************************************************************************************************

use "${date}/_data/spid_for_analysis_v2.dta", clear

clonevar temperature = temp

gen bin = .
	replace bin = 1 if temp <0
	replace bin = 2 if temp <3 & temp>=0
	replace bin = 3 if temp <6 & temp>=3
	replace bin = 4 if temp <9 & temp>=6
	replace bin = 5 if temp <12 & temp>=9
	replace bin = 6 if temp <15 & temp>=12
	replace bin = 7 if temp <18 & temp>=15
	replace bin = 8 if temp <21 & temp>=18
	replace bin = 9 if temp <24 & temp>=21
	replace bin = 10 if temp <27 & temp>=24
	replace bin = 11 if temp <30 & temp>=27
	replace bin = 12 if temp >=33
	
hist temperature, graphregion(color(white)) plotregion(color(white)) scheme(white_tableau) ///
	xtitle(Average temperature) xlabel(,nogrid noticks)
graph export "${date}/_figures/_fig_s2a.pdf", as(pdf) replace	

hist bin, freq graphregion(color(white)) plotregion(color(white)) scheme(white_tableau) ///
	xtitle(Temperature bin) name("gr2", replace) xlabel(1 "<0" 2 "[0,3)" 3 "[3,6)" 4 "[6,9)" ///
	5 "[9,12)" 6 "[12,15)" 7 "[15,18)" 8 "[18,21)" 9 "[21,24)" 10 "[24,27)" 11 "[27,30)" ///
	12 "30+", nogrid noticks)
graph export "${date}/_figures/_fig_s2b.pdf", as(pdf) replace	
	